<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
		<html>
		<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<title>Loudmouth</title>
		<META HTTP-EQUIV="EXPIRES" CONTENT=0>
		<link rel="stylesheet" href="../../../../docs.css">
		</head>
		<body>
		
<br>
<h1>Io Reference</h1>
<br><br><br>
<br><br><br>
<a class='column' href='../../index.html'>Networking</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<a class='column' href='../index.html'>Loudmouth</a>
&nbsp;&nbsp;<font color=#ccc>/</font>&nbsp;&nbsp;
<b>Loudmouth</b>
<br><br><br>
<br><br><br>
<table border=0 cellspacing=0 style="margin-left:8em; width:40em; line-height:1.2em;">
<tr>
<td align=right></td>
<td></td>
<td><a href="http://groups.google.com/group/loudmouth-dev/">Loudmouth</a> is an async XMPP library written in C.

Example usage:
<code><pre>
acc := Loudmouth with("user@server.com", "super password") do(
  handleConnect = method(
    "Connected!" println)

  handleMessage = method(msg
    "#{msg from} > #{msg plainBody}" println
    body :=  msg plainBody

    if(body indexOf("#") == 0,
      body = doString(body) asString)

    # This way you can manipulate
    # XML nodes with SGML addon
    XmppChatMessage create\
      setPlainBody(body)\
      setTo(msg from)\
      sendVia(self)

    # or simply send the message (must be a Sequence)
    # (this is obviously faster)
    #self send(msg from, body))
)

acc connect
# Any Io code after this line won't be executed
# (unless called as Loudmouth callback or run in separate thread)
Loudmouth startMainLoop

</pre></code>
</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr><td colspan=3>&nbsp;</td></tr>
<tr>
<td align=right>
</td>
<td></td>
<td>
<hr align=left color=#ddd height=1>
<br><br>
<a name="Loudmouth-connect"></a><b>
connect
</b>
<p>
<div class=slotDescription>
Connects to the server. Returns <code>self</code>.
</div>
<a name="Loudmouth-disconnect"></a><b>
disconnect
</b>
<p>
<div class=slotDescription>
Disconnects from server and returns <code>true</code> if it succeeds.
</div>
<a name="Loudmouth-handleAuthenticated"></a><b>
handleAuthenticated
</b>
<p>
<div class=slotDescription>
Slot called upon successful authentication.
</div>
<a name="Loudmouth-handleAuthenticationFailure"></a><b>
handleAuthenticationFailure
</b>
<p>
<div class=slotDescription>
Slot called if username/password combinaton is wrong.
</div>
<a name="Loudmouth-handleConnect"></a><b>
handleConnect
</b>
<p>
<div class=slotDescription>
Slot called once connection is established.
</div>
<a name="Loudmouth-handleConnectFailure"></a><b>
handleConnectFailure
</b>
<p>
<div class=slotDescription>
Slot called when server is not reachable.
</div>
<a name="Loudmouth-handleDisconnect"></a><b>
handleDisconnect
</b>
<p>
<div class=slotDescription>
Slot called upon closing the connection with the server.
</div>
<a name="Loudmouth-handleMessage"></a><b>
handleMessage(xmppMessage)
</b>
<p>
<div class=slotDescription>
Slot called when a message arrives via XMPP stream. <code>xmppMessage</code> is a <code>LoudmouthMessage</code> object.
</div>
<a name="Loudmouth-handleSslFailure"></a><b>
handleSslFailure
</b>
<p>
<div class=slotDescription>
Slot called if SSL-related problems arrive. Method should return <code>true</code> if it wishes to make a connection without SSL, <code>false</code> otherwise.
</div>
<a name="Loudmouth-isConnected"></a><b>
isConnected
</b>
<p>
<div class=slotDescription>

</div>
<a name="Loudmouth-isSslSupported"></a><b>
isSslSupported
</b>
<p>
<div class=slotDescription>

</div>
<a name="Loudmouth-registerAccount"></a><b>
registerAccount(server, username, password)
</b>
<p>
<div class=slotDescription>
Registers a new account at XMPP server. Returns <code>true</code> or <code>false</code>.
</div>
<a name="Loudmouth-send"></a><b>
send(toJid, message)
</b>
<p>
<div class=slotDescription>
Sends a message (<code>Sequence</code>) to provided JID (<code>Sequence</code>). Returns <code>true</code> or <code>false</code>.
</div>
<a name="Loudmouth-sendRaw"></a><b>
sendRaw(body)
</b>
<p>
<div class=slotDescription>
Sends raw text over XMPP stream. Returns <code>true</code> if no errors occur.
</div>
<a name="Loudmouth-setPresence"></a><b>
setPresence(presence[, statusMessage])
</b>
<p>
<div class=slotDescription>
Sets availability/presence and status message.
</div>
<a name="Loudmouth-setStatusMessage"></a><b>
setStatusMessage(statusMessage)
</b>
<p>
<div class=slotDescription>
Sets status message.
</div>
<a name="Loudmouth-startMainLoop"></a><b>
startMainLoop
</b>
<p>
<div class=slotDescription>
Starts GMainLoop. Should be called after a connection is established with the server.
</div>
<a name="Loudmouth-status"></a><b>
status
</b>
<p>
<div class=slotDescription>
Returns status connection. Possible return values are:
<ul>
  <li><code>Loudmouth types CLOSED</code></li>
  <li><code>Loudmouth types OPENING</code></li>
  <li><code>Loudmouth types OPEN</code></li>
  <li><code>Loudmouth types AUTHENTICATING</code></li>
  <li><code>Loudmouth types AUTHENTICATED</code></li>
</ul>
</div>
<a name="Loudmouth-stopMainLoop"></a><b>
stopMainLoop
</b>
<p>
<div class=slotDescription>

</div>
<a name="Loudmouth-types"></a><b>
types
</b>
<p>
<div class=slotDescription>
<p>Object containing status codes and message types.</p>
  <pre><code>
  Loudmouth with("username@server.com", "password") do(
    handleConnect = method(
      self setPresence(Loudmouth types AVAILABLE), "Drinking lemonade...")
  )
  </code></pre>
</div>
<a name="Loudmouth-with"></a><b>
with(jid, password)
</b>
<p>
<div class=slotDescription>
Creates a new Loudmouth clone with server details provided in <code>jid</code>.
</div>
</td>
</tr>
</table>
<br><br><br><br><br>
</body>
</html>
